import service from "@/utils/request";
import type { Response, PageResponse, CodeName } from "@/types/common";
import type { CasbinDevItem, CasbinPageItem } from "@/types/pos/casbin";

// <any, Response<PageResponse<DevPageItem>>>
// <any, Response<DevPageItem>>
export const usePosCasbinPageApi = (params: object) => {
  return service<any, Response<PageResponse<CasbinPageItem>>>({
    url: `/v1/pos/casbin/page`,
    method: "GET",
    params,
  });
};
export const usePosCasbinQueryApi = (params: object) => {
  return service<any, Response<CasbinPageItem>>({
    url: `/v1/pos/casbin/query`,
    method: "GET",
    params,
  });
};

export const usePosCasbinCreateApi = (data: object) => {
  return service({
    url: `/v1/pos/casbin/create`,
    method: "POST",
    data,
  });
};

export const usePosCasbinUpdateApi = (data: object) => {
  return service({
    url: `/v1/pos/casbin/update`,
    method: "POST",
    data,
  });
};

export const usePosCasbinDeleteApi = (data: object) => {
  return service({
    url: `/v1/pos/casbin/delete`,
    method: "DELETE",
    data,
  });
};

// 人员绑定<any, Response<PageResponse<CodeName>>>
export const usePosCasbinEmployeePageApi = (params: object) => {
  return service<any, Response<PageResponse<CodeName>>>({
    url: `/v1/pos/casbinEmployee/page`,
    method: "GET",
    params,
  });
};

export const usePosCasbinEmployeeCreateApi = (data: object) => {
  return service({
    url: `/v1/pos/casbinEmployee/create`,
    method: "POST",
    data,
  });
};

export const usePosCasbinEmployeeDeleteApi = (data: object) => {
  return service({
    url: `/v1/pos/casbinEmployee/delete`,
    method: "DELETE",
    data,
  });
};

// 设备绑定
export const usePosCasbinDevicePageApi = (params: object) => {
  return service<any, Response<PageResponse<CasbinDevItem>>>({
    url: `/v1/pos/casbinDevice/page`,
    method: "GET",
    params,
  });
};

export const usePosCasbinDeviceCreateApi = (data: object) => {
  return service({
    url: `/v1/pos/casbinDevice/create`,
    method: "POST",
    data,
  });
};

export const usePosCasbinDeviceDeleteApi = (data: object) => {
  return service({
    url: `/v1/pos/casbinDevice/delete`,
    method: "DELETE",
    data,
  });
};

// 钱包类型绑定
export const usePosCasbinWalletCategoryPageApi = (params: object) => {
  return service<any, Response<PageResponse<CasbinDevItem>>>({
    url: `/v1/pos/casbinWalletCategory/page`,
    method: "GET",
    params,
  });
};

export const usePosCasbinWalletCategoryCreateApi = (data: object) => {
  return service({
    url: `/v1/pos/casbinWalletCategory/create`,
    method: "POST",
    data,
  });
};

export const usePosCasbinWalletCategoryDeleteApi = (data: object) => {
  return service({
    url: `/v1/pos/casbinWalletCategory/delete`,
    method: "DELETE",
    data,
  });
};

